package ${entityPackage};

import java.io.Serializable;
<#list importList as item>
import ${item};
</#list>

/**
 * ${tableComment}(table: ${tableName})
 * @author ${author}
 * @since ${date}
 */
<#if enableLombok>
@Getter
@Setter
@Accessors(chain = true)
</#if>
<#if enableSwagger3>
@Schema(name = "${tableComment}实体信息")
</#if>
public class ${entityName} implements Serializable {
    private static final long serialVersionUID = 1L;

<#list columns as column>
    <#if enableColumnComment>
    /** ${column.comment} */
    </#if>
    <#if enableSwagger3>
    @Schema(title = "${column.comment}", description = "${column.comment}")
    </#if>
    private ${column.javaType} ${column.javaFiled};

</#list>
<#if generateConvert>
    /**
    * 继承类转换
    * @author ${author}
    * @since ${date}
    * @param source: 源对象
    * @param target: 目标对象
    */
    public static  ${"<S"?js_string} extends ${entityName},T extends ${entityName}<#noparse>></#noparse> T convert(S source, T target){
        if (source == null) {
            return null;
        }
    <#list columns as column>
        target.set${column.javaFiled?cap_first}(source.get${column.javaFiled?cap_first}());
    </#list>
        return target;
    }
</#if>

<#if !enableLombok>
    <#list columns as column>
    public void set${column.javaFiled?cap_first}(${column.javaType} ${column.javaFiled}){
        this.${column.javaFiled} = ${column.javaFiled};
    }

    public ${column.javaType} get${column.javaFiled?cap_first}(){
        return ${column.javaFiled};
    }

    </#list>
</#if>
}
